from src.main.server.mapper.impl.vol_info_impl import VolInfoImpl
from src.main.server.pojo.Result import Result
from src.main.server.utils.gender_judge import process_data_gender


class VolInfoController:

    def __init__(self):
        self.impl = VolInfoImpl()

    def all_info(self):
        data = self.impl.all_info()
        return process_data_gender(data)

    def get_info(self, fd, sd):
        data = self.impl.get_info((fd, sd))
        return data

    def update(self, data):
        self.impl.update(data)
        return Result().success()

    def delete(self, data):
        self.impl.delete(data)
        return Result().success()

    def add_score(self, data):
        """data = (score, vol_name)"""
        self.impl.add_score(data)


if __name__ == '__main__':
    result = VolInfoController().all_info()
    print(result)
    print("=============")
    result_2 = VolInfoController().get_info("1","1")
    print(result_2)